import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# 创建网格数据
X = np.linspace(-3, 3, 100)
Y = np.linspace(-3, 3, 100)
X, Y = np.meshgrid(X, Y)

# 计算 Z 值
Z = (X**3 + Y) * np.exp(-(X**2 + Y**2))

# 创建 3D 图形
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.plot_surface(X, Y, Z, cmap="viridis")

# 设置标签
ax.set_xlabel("X axis")
ax.set_ylabel("Y axis")
ax.set_zlabel("Z axis")
ax.set_title("Surface plot of Z = (X^3 + Y) * exp(-(X^2 + Y^2))")

# 显示图形
plt.show()
